import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';

import 'ListViewPage.dart';
import 'SingleChildScrollViewPage.dart';

class ScrollBasePage extends StatelessWidget {
  List<String> items = [
    "scroll",
    "ListViewPage"
  ];

  getPage(int index) {
    switch (index) {
      case 0:
        return SingleChildScrollViewPage();
        case 1:
        return ListViewPage();
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('BaseLayoutPage'),
      ),
      body: ListView.builder(
          itemCount: items.length,
          itemBuilder: (context, index) {
            return GestureDetector(
              child: Padding(
                  padding: EdgeInsets.all(20),
                  child: Center(child: Text(items[index]))),
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return getPage(index);
                }));
              },
            );
          }),
    );
  }
}
